# code chunks work just like individual R scripts
# When knitted, all code chunks put add together
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.3 ✔ readr 2.1.4
## ✔ forcats 1.0.0 ✔ stringr 1.5.0
## ✔ ggplot2 3.4.3 ✔ tibble 3.2.1
## ✔ lubridate 1.9.3 ✔ tidyr 1.3.0
## ✔ purrr 1.0.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
mpg<-mtcars |>
group_by(cyl) |>
summarize(mean_mpg=mean(mpg))
mpg
## # A tibble: 3 × 2
## cyl mean_mpg
## <dbl> <dbl>
## 1 4 26.7
## 2 6 19.7
## 3 8 15.1
aov_out<-aov(mpg~cyl,data=mtcars) |>
summary()
fval=aov_out[[1]]$`F value`[1]
pval=aov_out[[1]]$`Pr(>F)`[1]
We can type results directly into text output with inline code.
There is a significant difference in mean miles per gallon between the number of cylinders in a car (F-value=79.561,p-value= 6.11^{-10}).
ggplot(mtcars, aes(x = wt, y = mpg, size = disp)) +
geom_point()+
theme_bw()
Italics works with asterisk
Bold works with double asterisks